<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/4/10/010
 * Time: 17:09
 */

namespace app\Lib\Model\AdminAuth\AdminMenu;


use app\Lib\Model\AdminAuth\MenuAuth;
use app\Lib\Model\DbModel\AdminMenu;

class GetMenuAllList
{
    /**
     *
     * @return false|\PDOStatement|string|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function run(){
        $model =  (new AdminMenu());
        $map =[
            $model->_status=>1,
        ];
        $result = $model->where($map)->column('id');
        $list = [];
        foreach ($result as $k=>$v){
            $menuAuth = new MenuAuth($v);
            $list[$k][$model->_name] = $menuAuth->getName();
            $list[$k][$model->_id] = $menuAuth->getMenuId();
            $list[$k][$model->_mark] = $menuAuth->getMark();
        }
        return $list;
    }


}